@layout("/common/_vue_container.html"){
<div id="app" v-cloak v-loading="fullscreenLoading" style="height:100%;">
    <div class="main_content">
        <div v-loading="screenLoading">
            <div class="remind_title2">
                版本管理
                <el-button
                        type="primary"
                        size="small"
                        class="product-new-button"
                        v-on:click="toNewDialog"
                >
                    新增
                </el-button>
            </div>
            <el-table ref="singleTable" :data="versionData" style="width: 100%">
                <el-table-column type="index" width="60" property="index">
                </el-table-column>
                <el-table-column property="id" label="id"></el-table-column>
                <el-table-column property="name" label="版本名称">
                </el-table-column>
                <el-table-column property="number" label="版本号">
                </el-table-column>
                <el-table-column property="filePath" label="文件地址">
                </el-table-column>
                <el-table-column label="状态" width="250">
                    <template scope="scope">
                        {{filterStatus(scope.row.status)}}
                    </template>
                </el-table-column>
                <el-table-column label="操作" width="250">
                    <template scope="scope">
                        <div  v-if="scope.row.status === 0">
                            <el-button type="text" size="small"
                                       v-on:click=toChange(scope.row.id,scope.row.status)>发布
                            </el-button>
                            <el-button type="text" size="small"
                                       v-on:click=toEditDialog(scope.row.id)>编辑
                            </el-button>
                            <el-button type="text" size="small"
                                       v-on:click=deleteVersion(scope.row.id)>删除
                            </el-button>
                        </div>
                        <div scope="scope" v-if="scope.row.status === 1">
                            <el-button type="text" size="small"
                                       v-on:click=toChange(scope.row.id,scope.row.status)>作废
                            </el-button>
                            <el-button type="text" size="small"
                                       v-on:click=deleteVersion(scope.row.id)>删除
                            </el-button>
                        </div>
                        <div scope="scope" v-if="scope.row.status === 2">
                            <el-button type="text" size="small"
                                       v-on:click=deleteVersion(scope.row.id)>删除
                            </el-button>
                        </div>
                    </template>
                </el-table-column>
            </el-table>
            <template>
                <el-pagination
                        background
                        v-on:current-change="handleCurrentChange"
                        :current-page.sync="pageNo"
                        :page-size="pageSize"
                        layout="total, prev, pager, next"
                        :total="total">
                </el-pagination>
            </template>
        </div>
    </div>
    <el-dialog title="新增" :visible.sync="dialogNewVisible">
        <div>
            <span style="display:inline-block;font-size: 16px; margin: 6px 0;">名称：</span>
            <el-input
                    placeholder="请输入内容"
                    v-model="newVersion.name"
                    clearable>
            </el-input>
        </div>
        <div>
            <span style="display:inline-block;font-size: 16px; margin: 6px 0;">版本号：</span>
            <el-input
                    placeholder="请输入内容"
                    v-model="newVersion.number"
                    clearable>
            </el-input>
        </div>
        <div>
            <span style="display:inline-block;font-size: 16px; margin: 6px 0;">apk上传：</span>
            <el-upload
                    action="${ctxPath}/cash/version/upload"
                    :on-remove="handleRemove"
                    :before-remove="beforeRemove"
                    :limit="1"
                    :on-exceed="handleExceed"
                    :before-upload="beforeUpload"
                    :on-success="handleSuccess"
                    :file-list="fileList">
                <el-button size="small" type="primary">点击上传</el-button>
                <div slot="tip" class="el-upload__tip">只能上传apk文件，且不超过10M</div>
            </el-upload>
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button v-on:click="dialogNewVisible = false">取 消</el-button>
            <el-button type="primary" v-on:click="confirmCreate()">确 定</el-button>
        </div>
    </el-dialog>

    <el-dialog title="修改" :visible.sync="dialogUpdateVisible">
        <div>
            <span style="display:inline-block;font-size: 16px; margin: 6px 0;">名称：</span>
            <el-input
                    placeholder="请输入内容"
                    v-model="updateVersion.name"
                    clearable>
            </el-input>
        </div>
        <div>
            <span style="display:inline-block;font-size: 16px; margin: 6px 0;">版本号：</span>
            <el-input
                    placeholder="请输入内容"
                    v-model="updateVersion.number"
                    clearable>
            </el-input>
        </div>
        <div>
            <span style="display:inline-block;font-size: 16px; margin: 6px 0;">apk上传：</span>
            <el-upload
                    action="${ctxPath}/cash/version/upload"
                    :on-remove="handleRemove"
                    :before-remove="beforeRemove"
                    :limit="1"
                    :on-exceed="handleExceed"
                    :before-upload="beforeUpload"
                    :on-success="handleSuccess"
                    :file-list="fileList">
                <el-button size="small" type="primary">点击上传</el-button>
                <div slot="tip" class="el-upload__tip">只能上传apk文件，且不超过10M</div>
            </el-upload>
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button v-on:click="dialogUpdateVisible = false">取 消</el-button>
            <el-button type="primary" v-on:click="confirmUpdate()">确 定</el-button>
        </div>
    </el-dialog>

    <el-dialog title="删除确认" :visible.sync="dialogDeleteVisible">
        <div class="user-status-dialog-text">
            确定删除该版本？
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button v-on:click="dialogDeleteVisible = false">取 消</el-button>
            <el-button type="primary" v-on:click="confirmDelete()">确 定</el-button>
        </div>
    </el-dialog>

    <el-dialog title="改变状态" :visible.sync="dialogChangeVisible">
        <div class="user-status-dialog-text" v-if="status === 0">
            确定发布该版本？
        </div>
        <div class="user-status-dialog-text" v-if="status === 1">
            确定作废该版本？
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button v-on:click="dialogChangeVisible = false">取 消</el-button>
            <el-button type="primary" v-on:click="confirmChange()">确 定</el-button>
        </div>
    </el-dialog>


</div>
<script src="${ctxPath}/static/modular/cash/version/version_list.js"></script>
@}

